<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>订单</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        body {
            background-color:#faf9f9 ;
            width: 414px;
            height: 896px;
        }
        .iot_dingbu {
            width: 414px;
            height: 50px;
            color: #d8d5d5;
            font-size: 22px;
            position: relative;
            text-align: center;
            line-height: 50px;
        }
        .iot_liebiao {
            width: 414px;
            height: 60px;
            background-color: #fff;
        }
        .iot_liebiao ul li {
            width: 82.8px;
            height: 60px;
            text-align: center;
            line-height: 60px;
            float: left;
            list-style-type: none;
            color: #393939;
        }
        .iot_xia {
            width: 414px;
            height: 30px;
            line-height: 30px;
            color:#6e6e6e ;
            text-align: center;
            margin-top: 10px;
        }
        .iot_liebiao{
            background-image: url(../images/横线.png);
            background-repeat: no-repeat;
            background-size: 82.8px;
            background-position-y:12px ;
            background-position-x: 0px;
            transition: all .1s;
        }
    </style>
</head>
<body>
     <div  class="iot_dingbu">
        <a href="../考核2.html"><img src="../images/left2.png" style="left: 5px;top:12px;position:absolute;width: 25px;"></a>  订单列表
    </div>
    <div class="iot_liebiao">
        <ul>
            <li data-id="0" class="iot_li on">全部</li>
            <li data-id="1" class="iot_li">待付款</li>
            <li data-id="2" class="iot_li">待发货</li>
            <li data-id="3" class="iot_li">待收货</li>
            <li data-id="4" class="iot_li">待评价</li>
        </ul>
    </div>
    <div>
        <div class="iot_xia">
            没有更多数据~
        </div>
    </div>
</body>
<script>
    var liebiao = document.querySelectorAll('.iot_li')
    var liebiao1 =  document.querySelector('.iot_liebiao')
    // console.log(liebiao1);
    // for(var i = 0 ; i < liebiao.length;i++){
    //     liebiao[i].onclick = function(){
    //         for(var k = 0 ; k <liebiao.length ; k++){
    //             liebiao[k].className='iot_li'
    //         }
    //         this.classList.add('on')
    //     }
    // }
    for(var i = 0 ; i < liebiao.length;i++){
     liebiao[i].onclick = function(){
        var k = parseInt(this.getAttribute('data-id'))
        // console.log(k);
        var j =82.8*k
        console.log(j);
        liebiao1.style.backgroundPositionX= j+'px' ;
     }
    }
</script>
</html>